<?php 
/*
$JA#COPYRIGHT$
*/

// no direct access
defined('_JEXEC') or die('Restricted access'); 

if($user->id){
	if(!in_array($user->usertype, array('Public Back-end', 'Manager', 'Administrator', 'Super Administrator'))){
		echo $module_content;
	}else{
		echo "Your permission group is not supported by JA JobBoard Menu and refer to unsuported permission groups as below: 'Public Back-end', 'Manager', 'Administrator', 'Super Administrator'";
	}	
	?>
	
	<!-- Logout Form -->
	<?php if($params->def('showLoginForm', 0)){?>
	<div style="text-align:right;">
		<a href="<?php echo JRoute::_("index.php?option=com_user&task=logout&return=$return");?>" title="<?php echo JText::_( 'BUTTON_LOGOUT'); ?>"><?php echo JText::_( 'BUTTON_LOGOUT'); ?></a>
	</div>	
	<?php }
}
elseif($params->def('showLoginForm', 0)){
	if(JPluginHelper::isEnabled('authentication', 'openid')) :
		$lang->load( 'plg_authentication_openid', JPATH_ADMINISTRATOR );
		$langScript = 	'var JLanguage = {};'.
						' JLanguage.WHAT_IS_OPENID = \''.JText::_( 'WHAT_IS_OPENID' ).'\';'.
						' JLanguage.LOGIN_WITH_OPENID = \''.JText::_( 'LOGIN_WITH_OPENID' ).'\';'.
						' JLanguage.NORMAL_LOGIN = \''.JText::_( 'NORMAL_LOGIN' ).'\';'.
						' var modlogin = 1;';
		$document = &JFactory::getDocument();
		$document->addScriptDeclaration( $langScript );
		JHTML::_('script', 'openid.js');
	endif; ?>
	<form action="<?php echo JURI::root();?>index.php" method="post" name="form-login" id="form-login" >
		<?php echo $params->get('pretext'); ?>
		<fieldset class="input">
		<p id="form-login-username">
			<label for="modlgn_username"><?php echo JText::_('USERNAME') ?></label><br />
			<input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="18" />
		</p>
		<p id="form-login-password">
			<label for="passwd"><?php echo JText::_('PASSWORD') ?></label><br />
			<input id="passwd" type="password" name="passwd" class="inputbox" size="18" alt="password" />
		</p>
		<?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
		<p id="form-login-remember">
			<label for="modlgn_remember"><?php echo JText::_('REMEMBER ME') ?></label><input id="modlgn_remember" type="checkbox" name="remember" class="inputbox" style="border:0px; width:10%" value="yes" alt="Remember Me" />
		</p>
		<?php endif; ?>
		<input type="submit" name="Submit" class="button" value="<?php echo JText::_('LOGIN') ?>" />
		</fieldset>
		<ul>
			<li>
				<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=reset' ); ?>">
				<?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
			</li>
			<li>
				<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=remind' ); ?>">
				<?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a>
			</li>
			<?php
			$usersConfig = &JComponentHelper::getParams( 'com_users' );
			if ($usersConfig->get('allowUserRegistration')) : ?>
			<?php if ( $params->get('showRegisterEmployer', 1) ) : ?>
			<li>
				<?php $Itemid = get_Itemid(array('option'=>'com_jajobboard', 'view'=>'jauserregister', 'layout'=>'regemployerform'));?>
				<a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jauserregister&layout=regemployerform&Itemid='.$Itemid); ?>">
					<?php echo JText::_('REGISTER AS AN EMPLOYER'); ?>
				</a>
			</li>
			<?php 
			endif;
			if ( $params->get('showRegisterJobSeeker', 1) ) :
			?>
			<li>
				<?php $Itemid = get_Itemid(array('option'=>'com_jajobboard', 'view'=>'jauserregister', 'layout'=>'regjobseekerform'));?>
				<a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jauserregister&layout=regjobseekerform&Itemid='.$Itemid); ?>">
					<?php echo JText::_('REGISTER AS A JOB SEEKER'); ?>
				</a>
			</li>
			<?php endif; ?>
			<?php endif; ?>
		</ul>
		<?php echo $params->get('posttext'); ?>
	
		<input type="hidden" name="option" value="com_user" />
		<input type="hidden" name="task" value="login" />
		<input type="hidden" name="return" value="<?php echo $return; ?>" />
		<?php echo JHTML::_( 'form.token' ); ?>
	</form>	
<?php 
if($params->def('integrate_jarpxnow', 0)){	
	jimport("joomla.plugin.helper");
	$plg = JPluginHelper::getPlugin("system","plg_jarpxnow");
	if ($plg)
	{
		$plgparams = new JParameter($plg->params);
		
		foreach($plgparams->toArray() as $keyp => $valp){
		    if($params->get($keyp) == ""){
		       $params->set($keyp,$valp);
		    }
		}
		$tag = "";
		foreach($params->toArray() as $ktag => $vtag){
		   if(!is_array($vtag)){
		     $tag .=  $ktag." = '".$vtag."' ";
		   } 
		}
		
		echo "{jarpxnow ".$tag." }";
	}
}
?>
<?php }?>